<?php

class Model_DbTable_Resources extends Zend_Db_Table
{
    protected $_name = 'resources';
    protected $_primary = 'resid';
    protected $_dependentTables = array(
        'Model_DbTable_Permissions' ,
        'Model_DbTable_Resources'
    );
    protected $_referenceMap = array(
        'Category' => array(
            'columns' => 'rescategory_id' ,
            'refTableClass' => 'Model_DbTable_ResourcesCategory' ,
            'refColumns' => 'rcid'
        )
    );

    public function update (array $data, $where)
    {
        $filterArray = array(
            'resid' ,
            'resname'
        );
        $fields = $this->info(Zend_Db_Table_Abstract::COLS);
        foreach ($data as $key => $val) {
            if (in_array($key, $filterArray)) {
                unset($data[$key]);
            }
            if (! in_array($key, $fields)) {
                unset($data[$key]);
            }
        }
        return parent::update($data, $where);
    }
}